﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.Services;
using System.IO;
using Jxym.Common.MyFile;

namespace Jxym.wlkc2011
{
    /// <summary>
    /// test 的摘要说明
    /// </summary>
    [WebService(Namespace = "http://tempuri.org/")]
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    [System.ComponentModel.ToolboxItem(false)]
    public class AjaxUploadFile : System.Web.Services.WebService
    {
        /// <summary>
        /// 文件上传
        /// </summary>
        /// <returns></returns>
        [WebMethod]
        public string UploadFile()
        {
            string jsonStr = "{";
            UpLoad upload = new UpLoad();
            upload.RootPath = "/UpFiles/";
            upload.IsExtClass = true;
            upload.Save();
            string Err = upload.ErrorStr;
            jsonStr += "'msg':'" + upload.FileNames + "',";
            if (Err != "")
                jsonStr += "'success':'false','error':'" + Err + "',";
            else
                jsonStr += "'success':'true',";
            jsonStr = jsonStr.TrimEnd(',');
            jsonStr += "}";
            return jsonStr;
        }
    }
}
